package com.sky.context;

// 将线程封装为一个接口，这个接口用于获取登录员工的id
public class BaseContext {

    // 创建一个线程对象
    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    // 获取线程的id
    public static Long getCurrentId() {
        return threadLocal.get();
    }

    // 将线程的id修改为当前登录员工的id
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    // 清除线程的id
    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
